// import db from '../utils/mysql.js'
const url = require('url')
const info = require('debug')('log:info');
module.exports = async (req,res)=>{
	const u =url.parse(req.url);
	info('blog pathname:'+u.pathname);
	if(u.pathname == '/blog/list'){
		// const result = await blogList();
		const result =[{
			id:1,
			title:'mytitle',
			content:'mycontent',
			userName:'hy',
			createTime:'2018-01-31 08:12:13',
			userId:1,
		}]
		res.end(JSON.stringify({err:0,blogList:result}));
	}
}
// async function blogList(blog={}){
// 	let sql = "select a.id,a.title,a.content,a.create_id userId,a.create_time createTime,b.show_name userName from blog_publish a left join blog_user b on a.create_id=b.id where 1=1";
// 	const queryObj = {};
// 	if(blog.createId){
// 		sql += " and a.create_id=:createId";
// 		queryObj.createId = blog.createId;
// 	}
// 	return await db.query(sql+" order by a.create_id desc",queryObj);
// }